﻿
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ChongJu.ModelManager.Rating
{
    public class ImageIndexModel
    {
        /// <summary>
        /// 序号
        /// </summary>
        public int Index { get; set; }

        /// <summary>
        /// GUID
        /// </summary>
        public string Guid { get; set; }

        /// <summary>
        /// 解析图片详细信息
        /// </summary>
        public RatingResultModel ImageDetail { get; set; }

        /// <summary>
        /// 入站时间
        /// </summary>
        public DateTime? Inbound { get; set; }

        /// <summary>
        /// 接收图片时间
        /// </summary>
        public DateTime ReceiveImageTime { get; set; }

        /// <summary>
        /// 读取烟叶重量时间
        /// </summary>
        public DateTime? ReadWeightTime { get; set; }

        /// <summary>
        /// 开始解析图片时间
        /// </summary>
        public DateTime? AnayzeStartTime { get; set; }

        /// <summary>
        /// 结束解析图片时间
        /// </summary>
        public DateTime? AnayzeEndTime { get; set; }

        /// <summary>
        /// 发送到PLC完成时间
        /// </summary>
        public DateTime? SendPLCTime { get; set; }

        /// <summary>
        /// 发送PLC结束时间
        /// </summary>
        public DateTime? SendPLCEndTime { get; set; }

        /// <summary>
        /// 出站时间
        /// </summary>
        public DateTime? Outbound { get; set; }

        /// <summary>
        /// 发送指令到PLC状态
        /// true 已发送
        /// false 未发送
        /// </summary>
        public bool SendPLCStatus { get; set; }

        /// <summary>
        /// 解析图片总耗时（ms）
        /// 结束解析图片时间 - 开始解析图片时间
        /// </summary>
        public double AnayzeTotalTime
        {
            get
            {
                if (AnayzeEndTime == null | AnayzeStartTime == null)
                    return -1;

                return ((DateTime)AnayzeEndTime - (DateTime)AnayzeStartTime).TotalMilliseconds;
            }
        }

        /// <summary>
        /// 图片初始总耗时（ms）
        /// 发送到PLC完成时间 - 接收图片时间
        /// </summary>
        public double DealTotalTime
        {
            get
            {
                if (AnayzeEndTime == null | AnayzeStartTime == null)
                    return -1;

                return ((DateTime)AnayzeEndTime - (DateTime)AnayzeStartTime).TotalMilliseconds;
            }
        }

        /// <summary>
        /// json日志
        /// </summary>
        public JObject LogJson { get; set; }

        /// <summary>
        /// 是否是上层图片
        /// </summary>
        public bool IsUp { get; set; }
    }
}
